'use strict'

class allsticker {
    constructor() {
        this.param = '/'
    }
    //创建资源
    async post(c) {
        try {
            var obj = JSON.parse(c.body)
            var admin_id = obj.admin_id;
            console.log(2);
            var r = await c.service.psql.query(`update admin set admin_name='`
            +`${obj.admin_name}',admin_passwd = '${obj.admin_passwd}',contact = '${obj.concact}' where admin_id =`
            +` ${admin_id}`);
            var adminObj = await c.service.psql.query(`select * from admin where admin_id=${admin_id}`)
            console.log(3);
            return c.send(adminObj.rows[0]);
        }
        catch (err) {
            c.status(500).send('error');
        }
    }
}

module.exports = allsticker